Where x was at the start of this frame’s movement step, before this frame’s motion was applied.
xprev: real (read-only in practice)Where x was at the start of this frame's movement step, before this frame's motion was applied. Nothing stops you from assigning to it, but nothing reads it back either - the engine overwrites it at the start of every frame's motion phase regardless, so treat it as read-only in practice.
Like x itself, it is a place in the room counted from the room's top-left corner, so it can be compared with x directly.
Comparing x against xprev is a cheap way to ask "did this instance actually move this frame" without keeping your own extra bookkeeping variable.
if (x != xprev) {
frame_speed = 1;
} else {
frame_speed = 0;
}Runs after movement (Step End, S2.10's own order) and only keeps the walk animation (frame_speed) advancing while x actually changed this frame - a cheap "is this instance really moving" check with no extra state of its own to track.